From 4a2dee7ecb434d9e7588860c5440b7802f9bb56e Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Tue, 16 Sep 2003 20:32:26 +0000 Subject: [PATCH] bitkeeper revision 1.426 (3f67735ai0MOd0z8ockI7RQVT4dA_Q) fix broken checksum calculation code for UDP console. --- tools/misc/xen-clone | 4 ++-- xen/common/kernel.c | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/misc/xen-clone b/tools/misc/xen-clone index 6cffbb8ced..8e54ca64b2 100755 --- a/tools/misc/xen-clone +++ b/tools/misc/xen-clone @@ -39,8 +39,8 @@ UCCL) PATH=$PATH:/usr/groups/xeno/build_tools/bin mkdir -p install/boot cd install/boot - ln -sf ../../xeno-roots/roots . - ln -sf ../../xeno-roots/usr . + ln -sf ../../../xeno-roots/roots . + ln -sf ../../../xeno-roots/usr . ln -sf ../lib . ln -sf ../bin . ln -sf /usr/groups/srgboot/${USER}/xenoboot.sh . diff --git a/xen/common/kernel.c b/xen/common/kernel.c index cc70814718..9c0bb47dbd 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -461,9 +461,9 @@ unsigned short compute_cksum(unsigned short *buf, int count) unsigned long sum = 0; while ( count-- ) sum += *buf++; - sum += sum >> 16; - sum += sum >> 16; - return (unsigned short)~sum; + while ( sum >> 16 ) + sum = (sum & 0xffff) + (sum >> 16); + return (unsigned short) ~sum; } @@ -495,18 +495,19 @@ int console_export(char *str, int len) udph = (struct udphdr *)(iph + 1); skb_reserve(skb, sizeof(struct ethhdr)); - skb_put(skb, hdr_size + len); + skb_put(skb, hdr_size + len); /* Build IP header. */ iph->version = 4; iph->ihl = 5; - iph->frag_off= 0; + iph->tos = 0; + iph->tot_len = htons(hdr_size + len); iph->id = 0xdead; + iph->frag_off= 0; iph->ttl = 255; iph->protocol= 17; iph->daddr = htonl(0xa9fe0100); /* 169.254.1.0 */ iph->saddr = htonl(0xa9fefeff); /* 169.254.254.255 */ - iph->tot_len = htons(hdr_size + len); iph->check = 0; iph->check = compute_cksum((__u16 *)iph, sizeof(struct iphdr)/2); -- 2.30.2